<template>
  <div id="app">
    <el-container>
      <el-header
        style="height: 80px;border-bottom-width: 1px;border-bottom-style:solid;border-bottom-color:#d8e3ed;"
      >
        <el-row>
          <el-col :span="3" :offset="1">
            <div>
              <img src="./assets/system_logo.jpg" style="padding-top: 10px;">
            </div>
          </el-col>
          <el-col :span="10" :offset="10">
            <div>
              <h1>大蛤蟆VPN信息管理系统</h1>
            </div>
          </el-col>
        </el-row>
      </el-header>
      <el-container>
        <el-aside>
          <div id="nav">
            <el-menu :router="true" :default-active="$route.path">
              <template v-for="route in permission_routers">
                <el-menu-item
                  v-if="!route.children"
                  :index="route.path"
                  :key="route.path"
                  v-show="route.navbaritem"
                >
                  <i class="el-icon-menu"></i>
                  {{ route.navbaritem }}
                </el-menu-item>
                <el-submenu v-else :index="route.path" :key="route.path">
                  <template slot="title">
                    <i class="el-icon-menu"></i>
                    {{ route.navbaritem }}
                  </template>
                  <el-menu-item
                    v-for="child in route.children"
                    :index="route.path + '/' + child.path"
                    :key="route.path + '/' + child.path"
                  >{{ child.navbaritem }}</el-menu-item>
                </el-submenu>
              </template>
              <el-menu-item index="1">
                <i class="el-icon-circle-close"></i>
                <a href="/logout" style="text-decoration: none;">退出</a>
              </el-menu-item>
            </el-menu>
          </div>
        </el-aside>
        <el-main>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  computed: {
    ...mapGetters(["permission_routers"])
  }
};
</script>


<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
#nav {
  padding: 0px;
  text-align: left;
}

#nav a {
  font-weight: bold;
  color: #2c3e50;
}

#nav a.router-link-exact-active {
  color: #42b983;
}
</style>
